<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c"
           uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://www.rapid-framework.org.cn/rapid" prefix="rapid" %>
<rapid:override name="head">
    <title>添加考试</title>
</rapid:override>
<rapid:override name="content">
    <%
        String path = request.getContextPath();
        String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
    %>
    <form class="layui-form" id="changeform" method="post" action="<%=basePath%>admin/insertExam" style="margin:80px 400px; width:450px;">
        <input type="hidden" name="classId" value="${classId}">
        <div class="layui-form-item">
            <label class="layui-form-label">考试名称</label>
            <div class="layui-input-block">
                <input type="text" name="name" value="${exam.name}" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">考试时间</label>
            <div class="layui-input-block">
                <div class="layui-inline"> <!-- 注意：这一层元素并不是必须的 -->
                    <input type="text" name="time"  class="layui-input" id="examDate" >
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">地点</label>
            <div class="layui-input-block">
                <input type="text" name="place" value="${exam.place}" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">备注</label>
            <div class="layui-input-block">
                <input type="text" name="remark" value="${exam.remark}" autocomplete="off" class="layui-input">
            </div>
        </div>
    </form>
    <div class="layui-input-block" style="margin-left:500px;">
        <button type="button" onclick="javascript:history.back(-1);" class="layui-btn layui-btn-lg">
            返回上一页
        </button>

    </div>
    <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
    <script>
    </script>
</rapid:override>
<%@ include file="base.jsp" %>
<script>
    //Thu Aug 18 20:38:54 CST 2016
    function getTaskTime(strDate) {
        console.log("原始时间格式："+strDate);
        var date = new Date(strDate);
        var y = date.getFullYear();
        var m = date.getMonth() + 1;
        m = m < 10 ? ('0' + m) : m;
        var d = date.getDate();
        d = d < 10 ? ('0' + d) : d;
        var h = date.getHours();
        var minute = date.getMinutes();
        minute = minute < 10 ? ('0' + minute) : minute;
        var str = y+"-"+m+"-"+d+" "+h+":"+minute;
        console.log("转换时间格式："+str);
        return str;
    };
    var cst = "${exam.time}"
    var time = getTaskTime(cst)
    $("#examDate").val(time)
    console.log(cst)

</script>
